<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="messageboard.css">
</head>
<body>
<?php 
	$host = 'localhost';
	$root = 'root';
	$pwd = 'root';
	$db = 'mymessageboard';
	$table = 'Messages';
	// 数据库连接
	$con = mysqli_connect($host, $root, $pwd);
	if (!$con) {
		echo "数据库连接失败<br>";
	}

	if (!mysqli_select_db($con, $db)) {
		echo "连接该数据库失败: $db <br>";
	}

	// 取值
	//INNER join ,left join , right join
	//$sql = "Select m.title as ttt,m.id as mid ,p.name from Messages m INNER join Persons p on m.personid = p.id";
	$vv = $_GET["id"];
	$sql = "Select m.*,p.name, p.id as userid from Messages m INNER join Persons p on m.personid = p.id And m.id = $vv ";
	// $sql = "SELECT * from Messages Where id = $vv";
	$ret = mysqli_query($con, $sql);
	if (!$ret) {
		echo "该表为空<br>";
	} else {
		while($row = mysqli_fetch_array($ret)) {
			$personid = $row["userid"];
			$title = $row["title"];
			$msgid = $row["id"];
			$content = $row["content"];
			$createtime = $row["createtime"];
			$personname = $row["name"];

			// $str = "<td>";
			// $str = "<li><a href='msgwrite.php?id=". $msgid ."'>" . "文章id = " . $msgid . ", 输出标题 = " . $row["title"] . ", 内容 = " . $content .", 名字 = " . $personname . ", 用户id = " . $personid . "<br>" .  "</li></a>";
			// // $str . = "</td";

			// echo $str;
		}

	}
?>
<!-- $html = " -->
<div id='header'>
	<h1><?php
	echo $title;
	?></h1>
	<p>旅游、摄影，感悟，心得</p>
</div>

<div id='menu'>
	这个菜单用
</div>

<!-- 内容 -->
<div id='content'>
	<div id='contentleft'>
		<div style='font-size: 25px; ''><strong><?php echo $title; ?></strong></div>
		<div style='padding-top: 20px; padding-bottom: 20px;''><?php echo $createtime;?></div>
		<div><?php echo $content ?></div>
	</div>
	<div id='contentright'>
		<div style='text-align: right; border-bottom-width: 3px; border-bottom-color: black; border-bottom-style: solid;''>关于我</div>
		<div align='center' style='position: relative; margin: 10px;'><img src='kr.jpg' style='width: 180px; height: 180px; border-radius: 90px;'></div>
		<div style='font-size: 20px; text-align: center;'><?php echo $personname ?></div>
		<div style='text-align: right; border-bottom-width: 0.5px; border-bottom-color: black; border-bottom-style: dashed; margin: 10px 0px 10px 0px;'></div>
		<div style='font-size: 16px; text-align: center;'><?php echo $personname ?></div>
		<div style='text-align: right; border-bottom-width: 0.5px; border-bottom-color: black; border-bottom-style: dashed; margin: 10px 0px 10px 0px;'></div>
	</div>

</div>

<!-- ";
echo $html;
?>	 -->




</body>
</html>